<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Witaj pacjencie #{loginBean.loginUser.login}</title>
</h:head>
<body>
	<ui:composition template="/pages/common/commonLayout.xhtml">
		<ui:define name="content">
			<h:form>
				<p:panel>
					<p:dataTable var="patient" value="#{patientMB.myPatients}"  paginator="true"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15" rows="10">
						<p:column headerText="name">
							<h:outputText value="#{patient.firstName} #{patient.lastName}"/>
						</p:column>
						<p:column headerText="pesel">
							<h:outputText value="#{patient.pesel}"/>
						</p:column>
						<p:column headerText="wiek">
							<h:outputText value="#{patient.age}"/>
						</p:column>
						<p:column headerText="email">
							<h:outputText value="#{patient.email}"/>
						</p:column>
						<p:column headerText="akcje">
							<p:commandButton id="editPatient" value="Edytuj" icon="ui-icon-pencil" action="/pages/patient/editPatient?faces-redirect=true">
								<f:setPropertyActionListener value="#{patient}" target="#{userMBean.patient}" />
							</p:commandButton>
							<p:commandButton id="showPatient" value="Podglad" icon="ui-icon-search" action="/pages/patient/patientshow?faces-redirect=true">
								<f:setPropertyActionListener value="#{patient}" target="#{userMBean.patient}" />
							</p:commandButton>
							<p:commandButton id="addVisit" value="Nowa wizyta" icon="ui-icon-plusthick" action="/pages/visits/addVisit?faces-redirect=true">
								<f:setPropertyActionListener value="#{patient}" target="#{visitMB.chosenPatient}" />
							</p:commandButton>
						</p:column>
					</p:dataTable>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</body>
</html>
